<?php echo $this->Html->css('frontend/styles');?>
<div id="wr_left">
<?php echo $this->element('frontend/catelog');?>
<?php echo $this->element('frontend/hot');?>
<?php echo $this->element('frontend/new');?>       
<div class="clear"></div>
</div>
<?php 
if(!empty($product)){
    
?>
    <?php echo $this->Html->script('frontend/jquery-1.7.1.min');?>  
    <?php echo $this->Html->css("prettyPhoto") ;?>
    <?php echo $this->Html->script("jquery.prettyPhoto_s") ;?>
<script type="text/javascript">
	$(document).ready(function(){
         	$("a[rel^='prettyPhoto']").prettyPhoto();
	});
</script>
<div id="wr_right">
    <?php echo $this->element("frontend/advert");?>
    <div class="clear">&nbsp;</div>
    <div class="bg_dot">
        <div class="nav">
                <?php if($product['TypeProduct']['parent_id'] !=""){
                    $parent = $this->requestAction('/Pages/getTypeDetail/'.$product['TypeProduct']['parent_id']);
                ?>
                <h2><a target="_self" href=""><?php echo $parent['TypeProduct']['type_name'];?></a></h2>
                <h2><a class="arr"  target="_self" href=""><?php echo $product['TypeProduct']['type_name'];?></a></h2>
                <?php
                    
                }else{
                    ?>
                <h2><a  target="_self" href=""><?php echo $product['TypeProduct']['type_name'];?></a></h2>
                <?php } ?>
            </div>
        </div>
    <div class="product_detail">
    <div class="box_avatar">
        <div class="item">
            <div class="wr_img">
                <a rel="prettyPhoto" href="<?php echo $product['Product']['image']?>"  title="<?php echo $product['Product']['product_code']?>">
                        <img  src="<?php echo $product['Product']['image']?>" alt="<?php echo $product['Product']['product_code']?>" >
                </a>
               
            </div>
        </div>
    </div>
    <div class="box_content">
    <?php echo $this->Html->script('frontend/jquery.simplemodal');?>    
       <div class="title">
            <h1>
               <?php echo $product['Product']['product_code'].":".$product['Product']['product_name'];?>
                </h1>
        </div>
        <div class="info">
            <div class="area">
                <div>
                    Mã sản phẩm: <?php echo $product['Product']['product_code']; ?>
                </div>
                <div>
                    Tình trạng: <?php if($product['Product']['number']==0){
                        echo "Hết hàng";
                    }
                    else{
                        echo "Còn hàng";
                    }?>
                </div>
            </div>
            <div class="price">
                Giá: <span class="new"><?php echo number_format($product['Product']['price']);?>VNĐ</span>
                
            </div>
            <div class="order">
                <a href="<?php echo $this->Html->url("/pages/order/".$product['Product']['id']);?>">Đặt hàng</a>
                
            </div>
        </div>

        

        
    </div>
    <div class="clear">
    </div>
</div>
    <div class="clear"></div>
 <?php if(!empty($refProduct)){ ?>   
<div class="product_ref">
    
    <div class="bg_dot">
        <div class="caption">
            <a class="Product_Other">Sản phẩm liên quan</a>
        </div>

    </div>
    <div class="list" id="product_ref">
        <?php 
        $i=0;
        foreach($refProduct as $kRefProduct=>$vRefProduct){
        $i++;    
        ?>
                <div class="item <?php echo ($i%4==0)?'last':''?>">
                    <div class="wr_img">
                        <a href="<?php echo $this->Html->url("/products/detail/".$vRefProduct['Product']['id']);?>" rel="" title="" class="item-image" target="_self">
                            <img style="display:block;margin: 0 auto;width: 178px !important; height: 269px !important;" src="<?php echo $vRefProduct['Product']['image'];?>" alt="<?php echo $vRefProduct['Product']['product_code'];?>">
                        </a>
                    </div>
                    <div class="title">
                        <a target="_self" href="<?php echo $this->Html->url("/products/detail/".$vRefProduct['Product']['id']);?>">
                            <?php echo $vRefProduct['Product']['product_name'];?>
                        </a>
                    </div>
                    <div class="price">
                        <a target="_self" href="#">
                            <?php echo number_format($vRefProduct['Product']['price']);?>VNĐ
                        </a>
                       
                        <?php if($vRefProduct['Product']['type']==1)
                        {?>
                        <img src="<?php echo $this->webroot . "img/frontend/"?>icon_new.png" class="">
                        <?php }else if($vRefProduct['Product']['type']==2){?>
                          <img src="<?php echo $this->webroot . "img/frontend/"?>ishot.gif" class="">
                      
                            <?php }?>
                    </div>
                </div>
        <?php } ?>
            
               
            
    </div>
    <div class="clear">
    </div>
    <?php if($this->params['paging']['Product']['pageCount'] > 1) {?>
       <div class="pager pager">
                    <?php
                   
                    echo "<ul>";
                     echo $this->Paginator->prev('  << ', null, null, array('tag' => 'span', 'class' => 'prev'));

                    echo $this->Paginator->numbers(array('modulus' => 4, "separator" => "&nbsp;", "tag" => "li", 'currentTag' => 'a', 'class' => 'paginate'));
                     echo $this->Paginator->next(' >>', null, null, array('tag' => 'span', 'class' => 'next'));
                  
                    echo "</ul>";
                    ?>

                </div>
    <?php } ?>
</div> 
 <?php } ?>
      



    </div>
<?php } ?>
<script>
$(document).ready(function(){
				           $('a.jqzoom').jqzoom({
												zoomType: 'reverse'
					        				  });
					});
</script>

